The present invention relates generally to data processing systems, and more particularly to processing in different contexts using a processor.
Many computer systems today use virtual memory systems to manage and allocate memory to various processes running within the system, which allow each process running on the system to operate as if it has control of the full range of addresses provided by the system. The operating system (OS) maps the virtual address space for each process to the actual physical address space for the system. Mapping from a physical address to a virtual address is typically maintained through the use of page tables.
Processor performance is improved via multiple-stage pipeline architecture, in which various pipeline resources, such as caches, buffers, arrays, and the like may be used to more efficiently execute instructions. One such pipeline resource that improves use of virtual memory systems is a translation lookaside buffer (TLB). A TLB is a relatively small section of memory in a processor pipeline which caches part of the system's virtual address to physical address translations. Specifically, a few elements of the translation set are stored in the TLB which the processor can access extremely quickly. Various TLBs may exist in a system. For example, separate TLBs may exist for instructions and data (respectively, an instruction TLB (iTLB) and a data TLB (dTLB)). More so, in certain systems a second level dTLB (STLB) may be present.
If a translation for a particular virtual address is not present in the TLB, a “translation miss” occurs and the address translation is resolved using more general mechanisms. Processing in this manner continues until a context switch occurs. A context switch may occur when a multitasking OS stops running one process (e.g., an application) and begins running another. When a context switch occurs, page tables including a page directory and a page table for the new process are loaded, and the TLB and other pipeline resources must be flushed. By flushed, it is meant that the resources' contents are cleared.
Context switches cause considerable overhead in modern microprocessors. This overhead is exacerbated by large second level TLBs that must be flushed and reloaded on every context switch. Thus this overhead can adversely impact performance, especially in systems with many active contexts. A need thus exists to more efficiently maintain pipeline resources on context switches.